<template>
  <div id="app">
    <h2>---------------</h2>
    <h2>{{ $store.state.info }}</h2>
    <button @click="updateinfo">修改信息</button>

    <h2>{{ $store.state.count }}</h2>
    <button @click="add()">+</button>
    <button @click="cut()">-</button>
    <h2>----------------</h2>
    <h2>{{ $store.getters.more20age }}</h2>
    <h2>{{ $store.getters.more20agelength }}</h2>
    <h2>{{ $store.getters.morAgeStu(20) }}</h2>
    <homework></homework>
  </div>
</template>

<script>
import homework from "./components/homework";
export default {
  name: "App",
  components: {
    homework
  },
  methods: {
    add() {
      return this.$store.commit("increment");
    },
    cut() {
      return this.$store.commit("substract");
    },
    updateinfo() {
      /*  return this.$store.commit("updateinfo"); */
      return this.$store.dispatch("aupdateinfo");
    }
  }
};
</script>

<style></style>
